#ifndef _OCPP_RequestHandlerHolder_H__
#define _OCPP_RequestHandlerHolder_H__

#include "ResponseHandler.h"
#include "RequestHandler.h"

namespace OCPP
{
	class _MainExport RequestHandlerHolder
	{
	protected:
		CORE_RW_MUTEX(mRWMutex);
		RequestHandler* mHandler;
	public:
		RequestHandlerHolder(RequestHandler* handler);

		// Disconnect the handler to allow it to be destroyed
		void disconnectHandler();

		/** Get handler pointer - note, only use this for == comparison or similar,
			do not attempt to call it as it is not thread safe.
		*/
		RequestHandler* getHandler();

		/** Process a request if possible.
		@return Valid response if processed, null otherwise
		*/
		Response* handleRequest(const Request* req, const WorkQueue* srcQ);
	};
}

#endif